import java.util.*;

class Student{
    public int age;

    public Student(int age) {
        this.age = age;
    }

    @Override
    public String toString() {
        return "Student{" +
                "age=" + age +
                '}';
    }

    @Override
    public boolean equals(Object obj) {
        //引用地址相同返回ture
        if(this==obj)return true;
        //等于null返回false
        if(obj==null)return false;
        //判断obj对象是否为Student类的对象
        if(!(obj instanceof Student))return false;
        //比较年龄是否相等
        Student stu1=(Student) obj;
        if(this.age==stu1.age){
            return true;
        }
        return false;
    }
}
public class Test {
    public static void main(String[] args) {
        /*Scanner scanner=new Scanner(System.in);
        while (scanner.hasNext()){
            int tmp=scanner.nextInt();
        }*/
        List<String> list = new ArrayList<>();
        list.add("JavaSE");
        list.add("JavaWeb");
        list.add("JavaEE");
        list.add("JVM");
        list.add("测试课程");
        Iterator<String>iterator=list.listIterator();
        ListIterator<String>iterator1=list.listIterator();
        System.out.println(list);
        iterator.next();
        iterator.remove();
        System.out.println(list);
    }
    public static void main3(String[] args) {
        List<String> list = new ArrayList<>();

        list.add("JavaSE");
        list.add("JavaWeb");
        list.add("JavaEE");
        list.add("JVM");
        list.add("测试课程");
        List<String>ret=list.subList(1,3);
        System.out.println(list);
        System.out.println(ret);
        ret.set(0,"wzj66");
        System.out.println(ret);
        System.out.println(list);
    }
    public static void main2(String[] args) {
        List<Integer> arrayList=new ArrayList<>();
        arrayList.add(1);
        arrayList.add(2);
        arrayList.add(3);
        List<Integer> arrayList1=new ArrayList<>();
        arrayList1.add(1);
        arrayList1.add(2);
        arrayList1.add(3);
        System.out.println(arrayList.containsAll(arrayList));
        System.out.println(arrayList1);
    }
    public static void main1(String[] args) {
        List<Integer> arrayList=new ArrayList<>();
        arrayList.add(1);
        arrayList.add(1,2);
        List<Integer> arrayList1=new ArrayList<>();
        arrayList1.add(3);
        arrayList1.addAll(arrayList);
        arrayList1.remove(0);
        List<Student>list2=new ArrayList<>();
        list2.add(new Student(1));
        list2.add(new Student(2));
        System.out.println(list2);
        System.out.println(list2.get(1));
        list2.set(1,new Student(3));
        System.out.println(list2.lastIndexOf(new Student(3)));
        System.out.println(list2.contains(new Student(3)));
        System.out.println(list2);
        System.out.println(arrayList1);
    }
}
